package com.gitee.wsl.test

import com.gitee.wsl.base.Tuple10
import com.gitee.wsl.base.Tuple2
import com.gitee.wsl.base.Tuple3
import com.gitee.wsl.base.Tuple4
import com.gitee.wsl.base.Tuple5
import com.gitee.wsl.base.Tuple6
import com.gitee.wsl.base.Tuple7
import com.gitee.wsl.base.Tuple8
import com.gitee.wsl.base.Tuple9

fun <A> forAll(vararg rows: A, testfn: (A) -> Unit) {
    rows.forEach { testfn(it) }
}

fun <A, B> forAll(vararg rows: Tuple2<A, B>, testfn: (A, B) -> Unit) {
    rows.forEach { testfn(it.first,it.second) }
}

fun <A, B, C> forAll(vararg rows: Tuple3<A, B,C>, testfn: (A, B,C) -> Unit) {
    rows.forEach { testfn(it.first,it.second,it.third) }
}

fun <A, B, C, D> forAll(vararg rows: Tuple4<A,B,C,D>, testfn: (A,B,C,D) -> Unit) {
    rows.forEach { testfn(it.first,it.second,it.third,it.fourth) }
}

fun <A, B, C, D,E> forAll(vararg rows: Tuple5<A,B,C,D,E>, testfn: (A,B,C,D,E) -> Unit) {
    rows.forEach { testfn(it.first,it.second,it.third,it.fourth,it.fifth) }
}

fun <A, B, C, D, E,F> forAll(vararg rows: Tuple6<A,B,C,D,E,F>, testfn: (A,B,C,D,E,F) -> Unit) {
    rows.forEach { testfn(it.first,it.second,it.third,it.fourth,it.fifth,it.sixth) }
}

fun <A, B, C, D, E,F,G> forAll(vararg rows: Tuple7<A,B,C,D,E,F,G>, testfn: (A,B,C,D,E,F,G) -> Unit) {
    rows.forEach { testfn(it.first,it.second,it.third,it.fourth,it.fifth,it.sixth,it.seventh) }
}

fun <A, B, C, D, E,F,G,H> forAll(vararg rows: Tuple8<A,B,C,D,E,F,G,H>, testfn: (A,B,C,D,E,F,G,H) -> Unit) {
    rows.forEach { testfn(it.first,it.second,it.third,it.fourth,it.fifth,it.sixth,it.seventh,it.eighth) }
}

fun <A, B, C, D, E, F, G, H, I> forAll(vararg rows: Tuple9<A, B, C, D, E, F, G, H, I>, testfn: (A,B,C,D,E,F,G,H,I) -> Unit) {
    rows.forEach { testfn(it.first,it.second,it.third,it.fourth,it.fifth,it.sixth,it.seventh,it.eighth,it.ninth) }
}

fun <A, B, C, D, E, F, G, H, I, J> forAll(vararg rows: Tuple10<A, B, C, D, E, F, G, H, I, J>, testfn: (A,B,C,D,E,F,G,H,I, J) -> Unit) {
    rows.forEach { testfn(it.first,it.second,it.third,it.fourth,it.fifth,it.sixth,it.seventh,it.eighth,it.ninth,it.tenth) }
}
fun <A> row(a: A) = a
fun <A, B> row(a: A, b: B) = Tuple2(a, b)
fun <A, B, C> row(a: A, b: B, c: C) = Tuple3(a, b, c)
fun <A, B, C, D> row(a: A, b: B, c: C, d: D) = Tuple4(a, b, c, d)
fun <A, B, C, D, E> row(a: A, b: B, c: C, d: D, e: E) = Tuple5(a, b, c, d, e)
fun <A, B, C, D, E, F> row(a: A, b: B, c: C, d: D, e: E, f: F) = Tuple6(a, b, c, d, e, f)
fun <A, B, C, D, E, F, G> row(a: A, b: B, c: C, d: D, e: E, f: F, g: G) = Tuple7(a, b, c, d, e, f, g)
fun <A, B, C, D, E, F, G, H> row(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H) = Tuple8(a, b, c, d, e, f, g, h)
fun <A, B, C, D, E, F, G, H, I> row(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I) = Tuple9(a, b, c, d, e, f, g, h, i)
fun <A, B, C, D, E, F, G, H, I, J> row(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J) = Tuple10(a, b, c, d, e, f, g, h, i, j)


